package me.xuym.crawler;


import com.cbs.java.component.application.Application;

/**
 * Created by broche on 05/08/2017.
 */
public abstract class Processor<INPUT, OUTPUT> {
    private Application application;

    private OUTPUT result;

    protected abstract OUTPUT onProcess(INPUT input) throws Exception;

    public Processor(Application application) {
        this.application = application;
    }

    public Application getApplication() {
        return application;
    }

    OUTPUT processData(INPUT input) throws Exception {
        result = onProcess(input);
        return result;
    }

    public Processor process(Processor processor) throws Exception {
        processor.processData(result);
        return processor;
    }
}
